package com.shujia.udf

import java.text.SimpleDateFormat
import java.util.Date

import org.apache.flink.table.functions.ScalarFunction

class DateUDF extends ScalarFunction {
  def eval(str: String): String = {
    val result = ""
    try {
      val date = new Date(str)
      val dateFormat = new SimpleDateFormat("yyyy-MM-dd hh")
      dateFormat.format(date)
    } catch {
      case e: Exception => result
    }

  }
}
